# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=lua-json4
_rockname=json4lua
pkgver=1.0.1
pkgrel=0
pkgdesc="JSON encoding / decoding module for Lua (JSON4lua)"
url="https://github.com/craigmj/json4lua"
arch="noarch"
license="MIT"
depends="lua"
source="$pkgname-$pkgver.tar.gz::https://github.com/craigmj/$_rockname/archive/$pkgver.tar.gz"
builddir="$srcdir/$_rockname-$pkgver"
options="!check"

_luaversions="5.1 5.2 5.3 5.4"
for _v in $_luaversions; do
	provides="$provides lua$_v-${pkgname#lua-}=$pkgver-r$pkgrel"  # for backward compatibility
done

package() {
	local rockdir="$pkgdir/usr/lib/luarocks/rocks-common/$_rockname/$pkgver-1"

	install -D -m 644 json/json.lua "$pkgdir"/usr/share/lua/common/json.lua

	mkdir -p "$rockdir"
	echo 'rock_manifest = {}' > "$rockdir"/rock_manifest
}

sha512sums="75ada289b56505899cf78ea8c2a756de2a75c23ce7f7e9451fa0e6fe63cee7a142d99ff52affc2b6c676b7c5fba6b3c6d0980230bf36e8e41bc44a61ef6b3a8f  lua-json4-1.0.1.tar.gz"
